package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.repair.enums.EmerProcTypeEnum;
import org.springblade.modules.repair.enums.WorkOrderTypeEnum;

import java.util.Date;
import java.util.List;

/**
 * @Date 16:43 2023/2/28
 * @Description {
 *
 * }
 * @Author lsay
 **/
@Data
public class RelevanceMalfunctionPlanVO {

	/**
	 * 工单id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	/**
	 * 电梯id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long elevatorId;

	/**
	 * 电梯状态： 1-正常,2-停梯
	 */
	private Integer elevatorStop;

	/**
	 * 故障现象
	 */
	private String problemItem;

	/**
	 * 故障现象描述
	 */
	private List<String> problemItemNames;

	/**
	 * 故障现象其他描述
	 */
	private String problemOtherDesc;

	/**
	 * 故障描述
	 */
	private String mfDesc;

	/**
	 * 电梯位置
	 */
	private String elevatorAddress;

	/**
	 * 项目名称
	 */
	private String buildingName;

	/**
	 * 审批id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long approveId;

	/**
	 * 工单状态
	 */
	private Integer status;

	/**
	 * 预计完成时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
	private Date finishDate;

	/**
	 * 是否允许操作
	 */
	private Boolean updateStatus;

	/**
	 * 故障信息
	 */
	private List<FaultMessageVO> faultMessageList;

	/**
	 * 报障信息
	 */
	private FaultReportVO faultReportVO;

	/**
	 * 故障原因
	 */
	private FaultReasonVO faultReasonVO;

	/**
	 * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 工单类型
	 */
	private Integer workOrderType;

	/**
	 * 紧急程度描述
	 */
	private String emerProcTypeName;

	/**
	 * 工单类型描述
	 */
	private String workOrderTypeName;

	public void setEmerProcType(Integer emerProcType) {
		if(Func.isNotEmpty(emerProcType)){
			this.emerProcTypeName = EmerProcTypeEnum.getName(emerProcType);
		}
		this.emerProcType = emerProcType;
	}

	public void setWorkOrderType(Integer workOrderType) {
		if(Func.isNotEmpty(workOrderType)){
			this.workOrderTypeName = WorkOrderTypeEnum.getName(workOrderType);
		}
		this.workOrderType = workOrderType;
	}

}
